#!/bin/bash
#
#make TYPE=TSN_SIM 表示对tsn仿真应用场景进行编译
#make TYPE=TSN_FPGA 表示对tsn FPGA应用场景进行编译

CC=gcc -g
AR=ar

LDHDPATH = -I ./include -I ../libsim/include 
LDLIBS =-lm -L ./libsim/ -lsim

LIBSRC=./src/


all: clean libtsmp.a

libtsmp.a:

ifeq (TSN_FPGA,$(TYPE))
	$(CC) -o $(LIBSRC)tsmp_pkt_io.o -c $(LIBSRC)tsmp_pkt_io.c $(LDLIBS) $(LDHDPATH)
else ifeq (TSN_SIM,$(TYPE))
	$(CC) -o $(LIBSRC)tsmp_pkt_io.o -c $(LIBSRC)tsmp_pkt_io_sim.c $(LDLIBS) $(LDHDPATH)
endif
	$(CC) -o $(LIBSRC)tsmp_reg_cfg.o -c $(LIBSRC)tsmp_reg_cfg.c $(LDLIBS) $(LDHDPATH)

	ar -rc libtsmp.a $(LIBSRC)tsmp_pkt_io.o  $(LIBSRC)tsmp_reg_cfg.o

clean:
	rm -rf $(LIBSRC)*.o *.a 
	
